#ifndef _PROPERTIES_HPP
#define _PROPERTIES_HPP 1

#include <string>
#include <iostream>
#include <map>
#include <boost/shared_ptr.hpp>
#include "PropertiesFailure.hpp"
#include "../constants.hpp"
#include "../Common.hpp"


namespace BFT
{

	namespace membership {
    
		class Properties : public std::map<std::string, std::string> 
		{
  			public:
  			// Constructor
			Properties(const std::string& initFileName);

    			// static methods
    			static boost::shared_ptr<Properties> getInstance(const std::string& initFileName = CONFIG_FILE_NAME) ;
    
    			void refresh();
    			void load(const std::string& initFileName) throw (PropertiesFailure);
			void save(const std::string& outputFileName) throw (PropertiesFailure);
			void printInfo();
    
			int getInt(const std::string& property, int defaultValue = 0);
			bool getBool(const std::string& property, bool defaultValue = false);
			std::string getString(const std::string& property, const char* defaultValue = "");
    
    
  			protected:
    			// Singleton object
    			static boost::shared_ptr<Properties> _instance ;
    
			#if defined(__MULTITHREAD__)	
			static pthread_mutex_t _lock ;
			#endif
  		};
  } //namespace membership
} //namespace BFT


#endif // _PROPERTIES_HPP

